package src.com.test.oneDay;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class demo3 {


    List<String> res = new ArrayList<>();
    StringBuilder path = new StringBuilder();
    String[] sumImpressiom = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    public List<String> letterCombinations(String digits) {

        if(digits == null || digits.length() == 0){
            return res;
        }
        traceBacking(digits,0);

        return res;

    }
    public void traceBacking(String digits,int index){

        if(index == digits.length()){
            res.add(new String(path));
            return;
        }

        int n = Integer.parseInt(digits.charAt(index) + "");
        String k = sumImpressiom[n];

        for(int i = 0;i < k.length();i++){

            path.append(k.charAt(i));
            traceBacking(digits,index+1);
            path.deleteCharAt(path.length()-1);
        }



        }




}
